import requests

def fetch_curseforge_data():
    # 逐步测试不同的查询条件
    url = "https://api.curseforge.com/v1/mods/search?gameId=432"
    headers = {
        "x-api-key": "你的API密钥"
    }
    response = requests.get(url, headers=headers)

    if response.status_code == 200:
        data = response.json()
        if data['data']:
            print("抓取到的整合包数据：")
            for modpack in data['data']:
                print(f"名称: {modpack['name']}")
        else:
            print("API 响应数据为空，请检查查询条件。")
    else:
        print(f"请求失败，状态码: {response.status_code}")
        print("响应内容:", response.text)

if __name__ == "__main__":
    fetch_curseforge_data()
